package com.example.robertluozizhao.framecollectdemo.adapter.holder;


import android.content.Context;

import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentPagerAdapter;

import com.example.robertluozizhao.framecollectdemo.activity.TouchOrScrollTestActivity;

import java.util.List;

/**
 * Created by robert.luozizhao on 2018/3/5.
 */

public class TouchOrScrollFragmentAdapter extends FragmentPagerAdapter {

    private Context mContext;
    private List<Fragment> mFragmentList;

    private String title[] = {"one","two","three"};

    public TouchOrScrollFragmentAdapter(FragmentManager supportFragmentManager, List<Fragment> mFragmentList, TouchOrScrollTestActivity context) {
        super(supportFragmentManager);
        this.mFragmentList = mFragmentList;
        mContext = context;
    }


    @Override
    public Fragment getItem(int position) {
        return mFragmentList.get(position);
    }

    @Override
    public int getCount() {
        if (mFragmentList==null) {
            return 0;
        }
        return mFragmentList.size();
    }

    @Override
    public CharSequence getPageTitle(int position) {
        return title[position];
    }
}
